package org.dawn.deveco.plugin.resourceeditor.model.interfaces;

import java.util.List;
import java.util.Vector;

public interface ResourceContent {

    // region 加载资源文件的状态
    enum LoadingState {
        SUCCESS_LOADED("加载成功"),
        NO_MEDIA_FILE("媒体文件不存在"),
        INVALID_MEDIA_FILE("无效的媒体文件"),
        FAILED_LOAD_IMAGE_FILE("图片文件加载失败"),
        UNKNOWN_ERROR("未知错误");

        private String message;

        LoadingState(String message) {
            this.message = message;
        }

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }
    }
    // endregion

    class ColumnConfig {
        public Class<?> columnClass = String.class;
        public String columnName = "";
        public boolean visible = true;
        public boolean editable = true;
        public boolean selectable = true;
        public String description = "";

        public ColumnConfig(String columnName, Class<?> columnClass, boolean visible, boolean editable, boolean selectable, String description) {
            this.columnClass = columnClass;
            this.columnName = columnName;
            this.visible = visible;
            this.editable = editable;
            this.selectable = selectable;
            this.description = description;
        }

        public ColumnConfig(String columnName, Class<?> columnClass, boolean visible, boolean editable, boolean selectable) {
            this(columnName, columnClass, visible, editable, selectable, "");
        }

        public ColumnConfig(String columnName, Class<?> columnClass, boolean visible, boolean editable) {
            this(columnName, columnClass, visible, editable, true, "");
        }
    }

    String DEFAULT_GROUP = "";

    Vector<Vector> getJTableContent(String group);

    List<String> getGroupList();

    String getCategory();

    void setCategory(String category);

    Class<?>[] getColumnClasses();

    boolean[] getColumnVisible();

    boolean[] getColumnEditable();

    boolean[] getColumnSelectable();

    Vector<String> getHeader();

    boolean isChanged();

    void setChanged(boolean changed);

    LoadingState getLoadingState();
    void setLoadingState(LoadingState loadingState);

    void syncGroupData(String group, Vector<Vector> data);

    boolean save();
}
